package top.xiaoshuaila.moments.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import top.xiaoshuaila.moments.pojo.RespBean;
import top.xiaoshuaila.moments.service.DynamicService;

@Controller
@RequestMapping("dynamic")
@Api(tags = "发布动态接口")
public class DynamicController {
    @Autowired
    private DynamicService dynamicService;
    @PostMapping(value = "savedynamic")
    @ResponseBody
    @ApiOperation("发布有图动态")
    public RespBean savedynamic(MultipartFile[] file, String text, boolean selfonly) {
        return dynamicService.savedynamic(file,text,selfonly);

    }
    @PostMapping(value = "savedynamicnp")
    @ResponseBody
    @ApiOperation("发布无图动态")
    public RespBean savedynamicnp(String text, boolean selfonly) {
        return dynamicService.savedynamic(new MultipartFile[0],text,selfonly);
    }
}
